package compiler;

import java.io.*;
import java.util.*;

import parser.*;
import lexer.*;
import generatedFiles.*;

public class Main {
        public static void main(String [] args) throws ParseException, IOException{        	    
        		String src = "D:\\BinaryTree.java";
        		String aux = "D:\\Auxiliar.java";
        		
                ArrayList<String> errors = new ArrayList<String>();
                ArrayList<String> lexicalErrorImages = new ArrayList<String>();               

                InputStream mjFile = new FileInputStream(src);              
                
                Lexer l = new Lexer(mjFile);                
                l.lexicalAnalysis(errors, lexicalErrorImages);                  
               
            	FileManipulation.makeParseFile(src, aux, lexicalErrorImages);                
                InputStream mjFileAux = new FileInputStream(aux);
                
                if(!errors.isEmpty()){
                    for(int i = 0; i < errors.size(); i++){
                            System.out.println(errors.get(i));
                    }                       
                }
                Parser p = new Parser(mjFileAux);                
                p.parsingAnalysis();        
        }
}
